<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <title>{% block title %}父模板{% endblock %}</title>
    {#  引入要用的jQuery 和 Bootstrap文件#}
    <script type="text/javascript" src="..\static\js\jquery.min.js"></script>
    <link rel="stylesheet" type="text/css" href="..\static\bootstrap-3.3.7-dist\css\bootstrap.css">
    <script type="text/javascript" src="..\static\bootstrap-3.3.7-dist\js\bootstrap.js"></script>
    {% block mycss %} {% endblock %}

</head>
<body>
    <nav class="navbar navbar-default">
      <div class="container-fluid">
        <!-- Brand and toggle get grouped for better mobile display -->
        <div class="navbar-header">
          <button type="button" class="navbar-toggle collapsed" data-toggle="collapse" data-target="#bs-example-navbar-collapse-1" aria-expanded="false">
            <span class="sr-only">Toggle navigation</span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
            <span class="icon-bar"></span>
          </button>
          <a class="navbar-brand" href="#">@博客</a>
        </div>

        <!-- Collect the nav links, forms, and other content for toggling -->
        <div class="collapse navbar-collapse" id="bs-example-navbar-collapse-1">
          <ul class="nav navbar-nav">

            <li><a href="{{ url_for('blog.index') }}">首页</a></li>
            <li><a href="{{ url_for('blog.publish') }}">发表博客</a></li>
          </ul>
          <form action="{{ url_for('blog.search') }}" class="navbar-form navbar-left">
            <div class="form-group">
              <input type="text" name="keyword" class="form-control" placeholder="请输入关键字">
            </div>
            <button type="submit" class="btn btn-default">搜索</button>
          </form>
          <ul class="nav navbar-nav navbar-right">
{#            {% if request.cookies.get('username') %}#}
{#                <li><a href="#">欢迎：{{ request.cookies.get('username') }}</a></li>#}
{#                <li><a href="{{ url_for('user.exit') }}">退出登录</a></li>#}
{#            {% else %}#}
{#                <li><a href="{{url_for('user.login')}}">登录</a></li>#}
{#                <li><a href="{{ url_for('user.register') }}">注册</a></li>#}
{#            {% endif %}#}
              {#              session会话机制#}
              {% if session.get('username') %}
                <li><a href="{{ url_for('user.infomation') }}">欢迎：{{ session.get('username') }}</a></li>
                <li><a href="{{ url_for('user.exit') }}">退出登录</a></li>
            {% else %}
                <li><a href="{{url_for('user.login')}}">登录</a></li>
                <li><a href="{{ url_for('user.register') }}">注册</a></li>
            {% endif %}
          </ul>
        </div><!-- /.navbar-collapse -->
      </div><!-- /.container-fluid -->
    </nav>

    {% block bodycontent %} {% endblock %}

    {% block myjs %} {% endblock %}
</body>
</html>